//
//  LLPayView.m
//  LoveLove
//
//  Created by 达迩科技 on 2019/4/9.
//  Copyright © 2019 wkf. All rights reserved.
//

#import "LLPayView.h"

@implementation LLPayView

- (instancetype)init {
    self = [super init];
    if(self) {
        [self setup];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

-(void)setup{
    
    self.maskButton = [[LLButton alloc] initWithFrame:self.bounds];
    self.maskButton.backgroundColor = LLColor(36, 42, 52);
    [self.maskButton addTarget:self action:@selector(didSelectCancle) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.maskButton];
    
    UIView *bgview = [[UIView alloc] initWithFrame:CGRectMake(50, LLScreenHeight/2-330/2, LLScreenWidth-100, 330)];
    bgview.layer.masksToBounds = YES;
    bgview.layer.cornerRadius = 10;
    bgview.backgroundColor = LLWhiteColor;
    [self addSubview:bgview];
    
    NSArray *titleArray = @[@"3.00",@"3.00",@"3.00",@"3.00",@"3.00",@"3.00"];
    NSArray *titleArray1 = @[@"3元",@"3元",@"3元",@"3元",@"3元",@"3元"];
    
    for (int i=0; i<titleArray.count; i++) {
        LLTwoLabelButton *button = [[LLTwoLabelButton alloc] initWithFrame:CGRectMake(bgview.width/2*(i%2), 110*(i/2), bgview.width/2, 110)];
        button.nameLabel.text = titleArray[i];
        button.nameLabel.textColor = LLColor(255, 0, 0);
        button.nameLabel.font = LLRegularFont(17);
        button.nameLabel.frame = CGRectMake(0, 31, button.width, 17);
        button.nameLabel.textAlignment = NSTextAlignmentCenter;
        button.numberLabel.text = titleArray1[i];
        button.numberLabel.textColor = LLColor(119, 119, 120);
        button.numberLabel.font = LLRegularFont(13);
        button.numberLabel.frame = CGRectMake(button.width/2-30, 65, 60, 24);
        button.numberLabel.backgroundColor = LLColor(221, 224, 227);
        button.numberLabel.layer.cornerRadius = 12;
        button.numberLabel.layer.masksToBounds = YES;
        button.numberLabel.textAlignment = NSTextAlignmentCenter;
        button.tag = i;
        [button addTarget:self action:@selector(didSelecttype:) forControlEvents:UIControlEventTouchUpInside];
        [bgview addSubview:button];
    }
    
}

- (void)didSelecttype:(LLTwoLabelButton *)button{
    if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectButton:didClickItem:)]) {
        [self.delegate didSelectButton:self didClickItem:button.tag];
    }
}

- (void)didSelectCancle{
    self.hidden = YES;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
